<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_JS的变量与常量</title>
</head>
<body>
    <script>
        var a = 1;
        console.log(a);
        var b = 3.14;
        console.log(b);
        var c = "hello world";
        console.log(c);
        var d = true;
        console.log(d);
        a = 5.5;
        console.log(a);
        var a = "哈哈哈我又来了";
        console.log(a);

        //ES6新增了let关键字来声明变量
        let x = 1;
        console.log(x);
        x = 5.5;
        console.log(x);
        let x = "哈哈哈我又来了";
        //console.log(x); //报错：用let关键字声明的变量在同一作用域下不能重复声明

        //使用const关键字声明常量
        const PI = 3.14;
        console.log(PI);
        //PI = 5.5; //报错：用const关键字声明的常量不能被重新赋值



    </script>
</body>
</html>